package com.briup.entity;

import java.io.Serializable;
import java.sql.Timestamp;

public class Environment implements Serializable {
    //环境种类名称 二氧化碳 光照 温湿度
    private String name;
    //发送端id 第1列
    private String srcId;
    //树莓派系统id  第2列
    private String desId;
    //实验箱区域模块id(1-8)  第3列
    private String devId;
    //模块上传感器地址  第4列
    private String sersorAddress;
    //传感器个数  第5列
    private int count;
    //发送指令标号 3表示接收数据 16表示发送命令
    private String cmd;  // 第6列
    //状态 默认1表示成功  第7列
    private int status;
    //环境值  第8列
    private float data;
    //采集时间  第9列
    private Timestamp gather_date;

    public Environment() {
    }


    public Environment(String line) {
        String[] arr = line.split(",");
        this.name = arr[0];
        this.srcId = arr[1];
        this.desId = arr[2];
        this.devId = arr[3];
        this.sersorAddress = arr[4];
        this.count = Integer.parseInt(arr[5]);
        this.cmd = arr[6];
        this.status = Integer.parseInt(arr[7]);
        this.data = Float.parseFloat(arr[8]);
        this.gather_date = Timestamp.valueOf(arr[9]);
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return srcId
     */
    public String getSrcId() {
        return srcId;
    }

    /**
     * 设置
     * @param srcId
     */
    public void setSrcId(String srcId) {
        this.srcId = srcId;
    }

    /**
     * 获取
     * @return desId
     */
    public String getDesId() {
        return desId;
    }

    /**
     * 设置
     * @param desId
     */
    public void setDesId(String desId) {
        this.desId = desId;
    }

    /**
     * 获取
     * @return devId
     */
    public String getDevId() {
        return devId;
    }

    /**
     * 设置
     * @param devId
     */
    public void setDevId(String devId) {
        this.devId = devId;
    }

    /**
     * 获取
     * @return sersorAddress
     */
    public String getSersorAddress() {
        return sersorAddress;
    }

    /**
     * 设置
     * @param sersorAddress
     */
    public void setSersorAddress(String sersorAddress) {
        this.sersorAddress = sersorAddress;
    }

    /**
     * 获取
     * @return count
     */
    public int getCount() {
        return count;
    }

    /**
     * 设置
     * @param count
     */
    public void setCount(int count) {
        this.count = count;
    }

    /**
     * 获取
     * @return cmd
     */
    public String getCmd() {
        return cmd;
    }

    /**
     * 设置
     * @param cmd
     */
    public void setCmd(String cmd) {
        this.cmd = cmd;
    }

    /**
     * 获取
     * @return status
     */
    public int getStatus() {
        return status;
    }

    /**
     * 设置
     * @param status
     */
    public void setStatus(int status) {
        this.status = status;
    }

    /**
     * 获取
     * @return data
     */
    public float getData() {
        return data;
    }

    /**
     * 设置
     * @param data
     */
    public void setData(float data) {
        this.data = data;
    }

    /**
     * 获取
     * @return gather_date
     */
    public Timestamp getGather_date() {
        return gather_date;
    }

    /**
     * 设置
     * @param gather_date
     */
    public void setGather_date(Timestamp gather_date) {
        this.gather_date = gather_date;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Environment{");
        sb.append("name='").append(name).append('\'');
        sb.append(", srcId='").append(srcId).append('\'');
        sb.append(", desId='").append(desId).append('\'');
        sb.append(", devId='").append(devId).append('\'');
        sb.append(", sersorAddress='").append(sersorAddress).append('\'');
        sb.append(", count=").append(count);
        sb.append(", cmd='").append(cmd).append('\'');
        sb.append(", status=").append(status);
        sb.append(", data=").append(data);
        sb.append(", gather_date=").append(gather_date);
        sb.append('}');
        return sb.toString();
    }
}
